import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;


public class snakeChunk {
	private int x;
	private int y;
	private int size;
	private int borderSize;
	private int frameNum;
	private Environment e;
	public snakeChunk(int x, int y, Environment e, int gridSize){
		this.x = x;
		this.y = y;
		this.size=(e.getWidth()-110)/gridSize;
		this.borderSize=50;
		this.e=e;
		frameNum=255;
	}
	
	public Graphics2D paint(Graphics2D gimage){
		gimage.setColor(new Color(frameNum,frameNum,frameNum));
		gimage.fill(new Rectangle(borderSize+x*size+1,borderSize+y*size+1,size-2,size-2));
		if(frameNum>0)
			frameNum-=200/e.getSnake().getSnakeBody().size();
		if(frameNum<=55){
			frameNum=55;
		}
		return gimage;
	}
	
	public int getX(){
		return x;
	}
	
	public int getY(){
		return y;
	}
}
